<?php
class SendEmail {
	function __construct() {

	}

	public function SendNotification($toEmail, $title, $html, $text, $fromMail , $fromName) {

		$header = "From: ".$fromName." <".$fromMail.">\n";
		$header .= "Reply-To: ".$fromName." <".$fromMail.">\n";
		$header .= "X-Mailer: ".$fromName."\n";


		$boundary = "Boundary" .md5(time()). "1";
		$boundary2 = "Boundary2" .md5(time()). "2";


		$header .= "MIME-Version: 1.0\n";
		$header .= "Content-Type: multipart/related;\n";
		$header .= " type=\"multipart/alternative\";\n";
		$header .= " boundary=\"$boundary\";";


		$message = "--$boundary\n";
		$message .= "Content-Type: multipart/alternative;\n";
		$message .= " boundary=\"$boundary2\";\n\n";


		$message .= "--$boundary2\n";
		$message .= "Content-Type: text/plain; charset=utf-8\n";
		$message .= "Content-Transfer-Encoding: 7bit\n\n";

		$message .= "$text\n\n";

		$message .= "--$boundary2\n";
		$message .= "Content-Type: text/html; charset=utf-8\n";
		$message .= "Content-Transfer-Encoding: 7bit\n\n";

		$message .= "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<style>
body {
	text-align: center;
	font-family: arial, sans-serif;
        font-size: 10px;
        color: #c9c9c9;
	width: 100%;
	margin: 0;
	padding: 0;
}
#content {
	width: 65%;
	text-align: left;
	margin: 5% auto;
}
#header {
	margin: 0 0 15px 0;
}
.title {
  background-color: #333333;
  border-bottom: 4px solid #000000;
  color: #fff;
  padding: 7px;
  font-size: 16px;
  font-weight: bold;
}
.invite {
  font-size: 12px;
}
.space{
	height: 0px;
}
.body {
  border: 1px solid #e1e1e1;
  padding: 28px;
  font-size: 12px;
  color: #262626;
  margin: 0 0 15px 0;
}
.b {
  color: #666;
  font-style: italic;
}
</style>
</head>
<body>
<div id=\"content\">
<div id=\"header\">
<table width=\"100%\" cellspacing=\"0\">
    <tr>
      <td height=\"28\" style=\"background-color: #333333; border-bottom: 4px solid #000000;\" class=\"title\"><font size=\"3\" color=\"#FFFFFF\">&nbsp;&nbsp;<b>$title</b></font></td>
    </tr>
    <tr>
      <td style=\"text-align: left; border: 1px solid #e1e1e1; padding: 28px; font-size: 12px; color: #262626; margin: 0 0 15px 0\" class=\"body\">
      $html
      </td>
    </tr>
  </table><br/>
  
</div>
</body>
</html>\n";
      $message .= "\n--$boundary2--\n";
      $message .= "\n--$boundary--\n";

      //$this->mail_utf8($toEmail,$title,$message,$header);
      
      
      $header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
      mail($toEmail,'=?UTF-8?B?'.base64_encode($title).'?=',$message,$header);
	}
}